﻿CREATE FUNCTION [audit].[GetTraceStatus]
(@TraceID INT)
RETURNS INT
AS
BEGIN
	DECLARE @ReturnValue int

	DECLARE @CurrentTraceStatusFlag int
	SET @CurrentTraceStatusFlag = 5

	SELECT @ReturnValue = CAST([value] AS int)
	FROM :: fn_trace_getinfo(default)
	WHERE([traceid] = @TraceID)
	  AND([property] = @CurrentTraceStatusFlag)

	RETURN(@ReturnValue)
END